<?php
    require ('../../Config.php');
    header("Content-type: text/html; charset=utf-8");
    $conn = new mysqli($MySqlHost,$MySqlUser,$MySqlPwd,$MySqlDatabaseName);
    mysqli_query($conn, "set character set 'utf8'");//读库
    mysqli_query($conn,"set names 'utf8'");//写库
    $user_name = $_POST["user_name"];
    if (mysqli_num_rows(mysqli_query($conn,"SELECT * FROM user_users WHERE User_Name = '$user_name'")) > 0 ){
        $res = mysqli_query($conn,"SELECT User_Name,aggregate,right_num,error_num FROM user_users WHERE User_Name = '$user_name'");
        $x = mysqli_fetch_row($res);
        $aggregate = $x[1];
        $right_num = $x[2];
        $error_num = $x[3];
        $accuracy = 0;
        if($aggregate!=0){
                $accuracy = $right_num / $aggregate  * 100; //正确率
        }
        echo "姓名".$x[0]." ";
        echo "总题数".$aggregate." ";
        echo "正确数".$right_num." ";
        echo "错误数".$error_num." "."<br>";
        echo "正确率".$accuracy ."% ";
    }else{
        echo "用户不存在";
    }